
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using System.Collections;

namespace jzlib.asp.net.Controls
{
    internal class CheckBoxColumnHelper
    {
        public static void SettingCheckBoxColumn(GridViewEx gv,ArrayList col)
        {
            if (gv.CustomColumns.MultiChooseColumn.Visible)
            {
                TemplateField checkColumn = new TemplateField();
                checkColumn.HeaderStyle.Width = gv.CustomColumns.MultiChooseColumn.Width;
                checkColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                checkColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                CheckBoxItemTemplate cbItemTemplate = new CheckBoxItemTemplate();
                checkColumn.ItemTemplate = cbItemTemplate;
                checkColumn.ItemStyle.Width = gv.CustomColumns.MultiChooseColumn.Width;
                CheckBoxHeaderTemplate cbHeaderTemplate = new CheckBoxHeaderTemplate(gv);
                checkColumn.HeaderTemplate = cbHeaderTemplate;
                if (gv.CustomColumns.MultiChooseColumn.Align == CustomColumnAlign.Left)
                {                  
                    col.Insert(0, checkColumn);                 
                }
                else if (gv.CustomColumns.MultiChooseColumn.Align == CustomColumnAlign.Right)
                {
                    col.Add(checkColumn);                  
                }
                else if (gv.CustomColumns.MultiChooseColumn.Align == CustomColumnAlign.Custom)
                {
                    col.Insert(gv.CustomColumns.MultiChooseColumn.Position, checkColumn);                    
                }                
            }             
        }     
    }
}
